﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json;
using System.Text;
using HigLabo.Core;

namespace HigLabo.Net.Dropbox
{
    public partial class DropboxClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task<AccountInfo> GetAccountInfoAsync()
        {
            return this.GetAccountInfoAsync(null);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task<AccountInfo> GetAccountInfoAsync(GetAccountCommand command)
        {
            return AsyncCall<GetAccountCommand, AccountInfo>(this.GetAccountInfo, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<String> CreateAccountAsync(CreateAccountCommand command)
        {
            return AsyncCall<CreateAccountCommand, String>(this.CreateAccount, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> GetMetadataAsync(GetMetadataCommand command)
        {
            return AsyncCall<GetMetadataCommand, Metadata>(this.GetMetadata, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public Task<Byte[]> GetFileAsync(String path)
        {
            return this.GetFileAsync(new GetFileCommand(path));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Byte[]> GetFileAsync(GetFileCommand command)
        {
            return AsyncCall<GetFileCommand, Byte[]>(this.GetFile, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        public Task<Metadata> UploadFileAsync(UploadFileCommand command)
        {
            return AsyncCall<UploadFileCommand, Metadata>(this.UploadFile, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Byte[]> GetThumbnailsAsync(GetThumbnailsCommand command)
        {
            return AsyncCall<GetThumbnailsCommand, Byte[]>(this.GetThumbnails, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <param name="size"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public Task<Byte[]> GetThumbnailsAsync(String path, ThumbnailSize size, ThumbnailFormat format)
        {
            var cm = new GetThumbnailsCommand();
            cm.Path = path;
            cm.Size = size;
            cm.Format = format;
            return AsyncCall<GetThumbnailsCommand, Byte[]>(this.GetThumbnails, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> CopyFileAsync(CopyFileCommand command)
        {
            return AsyncCall<CopyFileCommand, Metadata>(this.CopyFile, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fromPath"></param>
        /// <param name="toPath"></param>
        /// <returns></returns>
        public Task<Metadata> CopyFileAsync(String fromPath, String toPath)
        {
            var cm = new CopyFileCommand();
            cm.FromPath = fromPath;
            cm.ToPath = toPath;
            return AsyncCall<CopyFileCommand, Metadata>(this.CopyFile, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> MoveFileAsync(MoveFileCommand command)
        {
            return AsyncCall<MoveFileCommand, Metadata>(this.MoveFile, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="fromPath"></param>
        /// <param name="toPath"></param>
        /// <returns></returns>
        public Task<Metadata> MoveFileAsync(String fromPath, String toPath)
        {
            var cm = new MoveFileCommand();
            cm.FromPath = fromPath;
            cm.ToPath = toPath;
            return AsyncCall<MoveFileCommand, Metadata>(this.MoveFile, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> CreateFolderAsync(CreateFolderCommand command)
        {
            return AsyncCall<CreateFolderCommand, Metadata>(this.CreateFolder, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public Task<Metadata> CreateFolderAsync(String path)
        {
            var cm = new CreateFolderCommand();
            cm.Path = path;
            return AsyncCall<CreateFolderCommand, Metadata>(this.CreateFolder, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> DeleteAsync(DeleteCommand command)
        {
            return AsyncCall<DeleteCommand, Metadata>(this.Delete, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public Task<Metadata> DeleteAsync(String path)
        {
            var cm = new DeleteCommand();
            cm.Path = path;
            return AsyncCall<DeleteCommand, Metadata>(this.Delete, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> PutFileAsync(PutFileCommand command)
        {
            return AsyncCall<PutFileCommand, Metadata>(this.PutFile, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<List<Metadata>> GetRevisionsAsync(GetRevisionsCommand command)
        {
            return AsyncCall<GetRevisionsCommand, List<Metadata>>(this.GetRevisions, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<List<Metadata>> SearchAsync(SearchCommand command)
        {
            return AsyncCall<SearchCommand, List<Metadata>>(this.Search, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <param name="query"></param>
        /// <returns></returns>
        public Task<List<Metadata>> SearchAsync(String path, String query)
        {
            var cm = new SearchCommand();
            cm.Path = path;
            cm.Query = query;
            return AsyncCall<SearchCommand, List<Metadata>>(this.Search, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<Metadata> RestoreAsync(RestoreCommand command)
        {
            return AsyncCall<RestoreCommand, Metadata>(this.Restore, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<LinkInfo> GetShareableLinkAsync(GetShareableLinkCommand command)
        {
            return AsyncCall<GetShareableLinkCommand, LinkInfo>(this.GetShareableLink, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public Task<LinkInfo> GetShareableLinkAsync(String path)
        {
            var cm = new GetShareableLinkCommand();
            cm.Path = path;
            return AsyncCall<GetShareableLinkCommand, LinkInfo>(this.GetShareableLink, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<LinkInfo> GetMediaLinkAsync(GetMediaLinkCommand command)
        {
            return AsyncCall<GetMediaLinkCommand, LinkInfo>(this.GetMediaLink, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<LinkInfo> GetMediaLinkAsync(String path)
        {
            var cm = new GetMediaLinkCommand();
            cm.Path = path;
            return AsyncCall<GetMediaLinkCommand, LinkInfo>(this.GetMediaLink, cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<CopyRefInfo> GetCopyRefAsync(GetCopyRefCommand command)
        {
            return AsyncCall<GetCopyRefCommand, CopyRefInfo>(this.GetCopyRef, command);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public Task<DeltaInfo> GetDeltaAsync(GetDeltaCommand command)
        {
            return AsyncCall<GetDeltaCommand, DeltaInfo>(this.GetDelta, command);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task<Metadata> GetRootFolderAsync()
        {
            return AsyncCall<Metadata>(this.GetRootFolder);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task<List<Metadata>> GetRootItemsAsync()
        {
            return AsyncCall<List<Metadata>>(this.GetRootItems);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Task<List<Metadata>> GetRootFoldersAsync()
        {
            return AsyncCall<List<Metadata>>(this.GetRootFolders);
        }
    }
}
